package com.itheima.controller;

import com.itheima.dto.LoginDto;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import com.itheima.vo.LoginVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 6.1登录
 * @author GY
 * @version V1.0
 * @date 2025-01-16 11:12
 */
@Slf4j
@RequiredArgsConstructor
@RequestMapping("/login")
@RestController
public class LoginController {

    private final EmpService empService;
    /**
     * 员工登录
     */
    @PostMapping
    public Result login(@RequestBody LoginDto loginDto){
        log.info("LoginController loginDto:{}",loginDto);
        LoginVo loginVo = empService.login(loginDto);
        return Result.success(loginVo);
    }
}
